/*自己写的代码，测试10个对一个*/
#include <bits/stdc++.h>

using namespace std;
const int M = 100;
int ans = 0, a = 0, n, x, c[M], sum[M];
int main()
{
	cin >> n >> x;
	for (int i = 1; i <= n; i++)
	{
		cin >> c[i];
		sum[i] = sum[i - 1] + c[i];
		ans += sum[i];
	}
	for (int i = n; i >= 1; i--)
	{
		if (ans <= x)
		{
			cout << n - a << endl;
			break;
		}
		else
		{
			ans -= sum[i];
			a++;
		}
	}
	return 0;
}
/*
参考题解
#include<bits/stdc++.h>
using namespace std;
const int M=1000005;
int n,x,c[M],dp[M];
int main( )
{
	cin>>n>>x;
	for(int i=1;i<=n;i++)
	{
		cin>>c[i];
		c[i]*=(n-i+1);
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=x;j>=c[i];j--)
			dp[j]=max(dp[j],dp[j-c[i]]+1);
	}
	cout<<dp[x];

	return 0;
}
*/